package com.venutech.gongan.service.impl;


import com.venutech.gongan.dao.RzLogMapper;
import com.venutech.gongan.entity.RzLog;
import com.venutech.gongan.service.RzLogService;
import com.venutech.gongan.common.Convert;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@Slf4j
public class RzLogServiceImpl implements RzLogService {

    @Resource
    private RzLogMapper rzLogMapper;

    @Override
    public int addRzLog(int userId, int rzType, String rzMessage, int rzState, int appType) {
        RzLog rzLog = new RzLog();
        rzLog.setRz_user_id(userId);
        rzLog.setRz_type(rzType);
        rzLog.setRz_msg(rzMessage);
        rzLog.setRz_state(rzState);
        rzLog.setRz_url_state(appType);
        return insert(rzLog);
    }

    @Override
    public int insert(RzLog rzLog) {
        return rzLogMapper.insert(rzLog);
    }

    @Override
    public int deleteById(Integer rz_id) {
        return rzLogMapper.deleteById(rz_id);
    }

    @Override
    public RzLog getById(Integer rz_id) {
        return rzLogMapper.getById(rz_id);
    }

    @Override
    public int rzLogDeletes(String ids) {
        Long[] idss = Convert.toLongArray(ids);
        log.info("RzLogServiceImpl 批量删除："+idss);
        return rzLogMapper.rzLogDeletes(idss);
    }

//
//    @Override
//    public Page<RzLog> getInfo (Integer pageNo, Integer pageSize, String begintime, String endtime,
//                                String badw, Integer rz_type){
//        Page<RzLog> page = new Page<>(pageNo,pageSize);
//        List<RzLog> list = rzLogMapper.getInfo(begintime,endtime,badw,page,rz_type);
//        return page.setRecords(list);
//    }
//
//    @Override
//    public Page<RzLog> getInfo2(Integer pageNo, Integer pageSize, String begintime, String endtime,
//                                String badw) {
//        Page<RzLog> page = new Page<>(pageNo,pageSize);
//        List<RzLog> list = rzLogMapper.getInfo2(begintime,endtime,badw,page);
//        return page.setRecords(list);
//    }


}
